Skip to main content

Creating a Supplier in QuickBooks

Overview

This document provides a detailed guide on how to create a supplier using Intuit's QuickBooks API. Once the supplier is successfully created, the vendor1 ID will be retrieved and stored against the supplier as supplierFinanceId.

  • Creation of supplier from DI Admin

  • Creation of Supplier from Import Manager

For more info refer the Intuit's api docs for creating a vendor

Create a Supplier via QuickBooks API

  1. API Endpoint:

    • Use the following endpoint to create a new supplier:
      POST /v3/company/{companyId}/vendor
    • Replace {companyId} with your actual company ID.
  2. Request Payload:

  • Structure your request payload in JSON format to include supplier details. For example:

    {
    "PrimaryEmailAddr": {
    "Address": "fuelgood@gmail.com"
    },
    "PrimaryPhone": {
    "FreeFormNumber": "018928343"
    },
    "DisplayName": "AV-Fuel Good Repairs",
    "Suffix": "",
    "Title": "",
    "Mobile": {
    "FreeFormNumber": ""
    },
    "FamilyName": "",
    "TaxIdentifier": "",
    "AcctNum": "dfdxsp8s0vKnaEPutrfd",
    "CompanyName": "AV-Fuel Good Repairs",
    "BillAddr": {
    "City": "Brighton",
    "Country": "UK",
    "Line3": "Somerset",
    "Line2": "East Sussex",
    "Line1": "12 Dyke Rd",
    "PostalCode": "BN13FE",
    "CountrySubDivisionCode": ""
    },
    "GivenName": "",
    "PrintOnCheckName": "Fuel Good Repairs"
    }

    This table shows how fields from ViSN are mapped to the QuickBooks API.

    Field in QuickBooksField from ViSNNotes
    PrimaryEmailAddr.AddressEmailIf email isn't provided, email will default to "visn.accounts@digitalinnk.com"
    PrimaryPhone.FreeFormNumberPhone NumberPrimary phone number of the supplier.
    DisplayNameNameThe supplier's name prefixed with AV-
    SuffixNANA
    TitleNANA
    Mobile.FreeFormNumberNANA
    FamilyNameNANA
    TaxIdentifierNANA
    AcctNumDI Supplier IDSupplier ID from ViSN.
    CompanyNameNameThe supplier's name prefixed with AV-
    BillAddr.CityTownTown from supplier's address
    BillAddr.CountryCountryObtain the supplier's country based on its locale
    BillAddr.Line3DistrictDistrict from supplier's address
    BillAddr.Line2Street NameStreet Name from supplier's address
    BillAddr.Line1Building NumberBuilding Number from supplier's address
    BillAddr.PostalCodePost codePost code from supplier's address
    BillAddr.CountrySubDivisionCodeNANA
    GivenNameNANA
    PrintOnCheckNameNameName of the supplier to print on checks.

Handle the Response

  1. Successful Response:

    • Response from Quickbooks API:

      • The API will return a JSON response containing the details of the newly created supplier, including the VendorId
      {
      "Vendor": {
      "BillAddr": {
      "Id": "1010",
      "Line1": "12 Dyke Rd",
      "Line2": "East Sussex",
      "Line3": "Somerset",
      "City": "Brighton",
      "Country": "UK",
      "PostalCode": "BN13FE"
      },
      "Balance": 0,
      "AcctNum": "dfdxsp8s0vKnaEPutrfd",
      "Vendor1099": false,
      "CurrencyRef": { "value": "GBP", "name": "British Pound Sterling" },
      "domain": "QBO",
      "sparse": false,
      "Id": "959",
      "SyncToken": "0",
      "MetaData": {
      "CreateTime": "2024-08-08T07:26:01-07:00",
      "LastUpdatedTime": "2024-08-08T07:26:01-07:00"
      },
      "CompanyName": "AV-Fuel Good Repairs",
      "DisplayName": "AV-Fuel Good Repairs",
      "PrintOnCheckName": "Fuel Good Repairs",
      "Active": true,
      "PrimaryPhone": { "FreeFormNumber": "0112312312" },
      "PrimaryEmailAddr": { "Address": "fuelgood@gmail.com" }
      },
      "time": "2024-08-08T07:26:01.345-07:00"
      }
    • Logging: The logs for successful creation of supplier are logged in logs/quickbooks/suppliers/{supplierId} ref in Firestore,

    • Linking the supplier to Quickbooks:

      • The VendorId from the response "Id": "959" will be stored against the supplier in Firestore as financeSupplierId.
  2. Error Handling:

    • If the request fails, the API will return an error message, which is then handled and logged for troubleshooting

      • Logging: When an error occurs, the error details are logged to logs/quickbooks/suppliers/{supplierId} ref in Firestore.

      • Exception Handling: An exception is added to ancillaries/exceptions/suppliers/{accountId}-{supplierId} ref in Firestore for further analysis.

      • DI Admin: An error icon is displayed on DI Admin next to the affected supplier's name to indicate an issue.

Glossary

Vendor1 In the context of ViSN, a vendor is equivalent to a supplier.

Status: Approved
Category: Protected
Authored By: Hadley on August 9, 2024